package com.ligg.service.impl;

import com.ligg.mapper.UserMapper;
import com.ligg.pojo.User;
import com.ligg.service.UserService;
import com.ligg.utils.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    //根据查询用户名查询用户
    @Override
    public User findByUsername(String username) {
        return userMapper.findByUserName(username);
    }
    //注册用户
    @Override
    public void register(String username, String password) {
        //MD5加密
        String md5String = Md5Util.getMD5String(password);
        //注册用户
        userMapper.add(username, md5String);
    }
}
